using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Youshow.Ace.Domain.Models;
using Youshow.Ace.Domain.Repository;

namespace YayiMgr.Domain.SystemBase
{
    public class User:BaseModel<Guid>
    {
        [Comment("用户账号，手机号")]
        public string Account { get; set; }
        public string UserName { get; set; }
        public string Password { get; set; }
        public Guid? RoleID { get; set; }
        public bool? IsDelete { get; set; }
        [Comment("企业ID")]
        public Guid? CompanyId { get; set; }

        public static async Task<User> CheckLogin(string account, string password, IRepository<User> UserRepo)
        {
            User user = await UserRepo.GetAsync(u=>u.Account==account&&u.Password==password);
            return user;
        }
    }
}